<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <title>修改密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!--<%&#45;&#45;引入jquery&#45;&#45;%>-->
    <script th:src="@{/js/jquery-3.4.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/pwdmodify.js}"></script>
    <link rel="stylesheet" th:href="@{/css/layui.css}"  media="all">
    <script th:src="@{/js/layui.js}" charset="utf-8"></script>
    <script th:inline="javascript">
        /*<![CDATA[*/
        ctxPath = /*[[@{/}]]*/ '';
        /*]]>*/
        function check1() {
            $.post({
                url:ctxPath+"check1/num",
                data:{'oldPwd':$("#oName").val()},
                success:function (data) {
                    if(data.toString()=='ok'){
                        $("#oldInfor").css('color',"green");
                        $("#oldInfor").html("认证成功");
                    }else if(data.toString()=='false'){
                        $("#oldInfor").css('color',"red");
                        $("#oldInfor").html("旧密码不匹配");
                    }else{
                        $("#oldInfor").css('color',"red");
                        $("#oldInfor").html("密码不能为空");
                    }

                }
            });
        }
        function check2() {
            $.post({
                url:ctxPath+"check1/num",
                data:{'newPwd':$("#nName").val()},
                success:function (data) {
                    if(data.toString()=='ok'){
                        $("#newInfor").css('color',"green");
                        $("#newInfor").html("认证成功");
                    }else if(data.toString()=='false1'){
                        $("#newInfor").css('color',"red");
                        $("#newInfor").html("新旧密码相同");
                    }else{
                        $("#newInfor").css('color',"red");
                        $("#newInfor").html("密码不能为空");
                    }
                }
            });
        }
    </script>
</head>
<body>
<form th:action="${#servletContext.getContextPath()+'/check1/update'}" method="post">
    <div style="margin-top: 50px">
        旧密码:   <input type="password" name="oldPwd"   id="oName" onblur="check1()" value=""/><span id="oldInfor"/>
    </div>
    <div style="margin-top: 50px">
        新密码:   <input type="password" name="newPwd"   id="nName" onblur="check2()" value=""/><span id="newInfor"/>
    </div>
    <div style="margin-top: 50px">
        在次确定: <input type="password" name="rPwd"  id="rName" value="" /><span id="reviewInfor"/>
    </div>
    <div style="margin-top: 50px;float: left">
        <input type="submit" value="提交" />
    </div>
    <div style="float: left; margin-top: 50px;margin-left: 50px">
        <input type="reset" onclick="window.location.href='/check/main'" value="返回"/>
    </div>
</form>
<div style="margin-top: 50px">
    <span th:text="${msg}" style="font-family: 楷体;font-size: 25px;color: red"/>
</div>

</body>